Constructs an ordered enumeration from an unordered enumeration
Syntax
Parameters
- comparer
- unordered
Example
Library/Library.Test/TestOrderedEnumeration.cs
C# | Copy Code |
---|
var ordered = new OrderedEnumeration<byte>(Comparer<byte>.Default, FailBeforeYield<byte>(true));
Assert.IsTrue(ReferenceEquals(Comparer<byte>.Default, ordered.Comparer));
ordered.Comparer = new ReverseOrder<byte>(ordered.Comparer);
Assert.IsTrue(ordered.Comparer is ReverseOrder<byte>);
Assert.IsNull(ordered.Serializer);
ordered.Serializer = PrimitiveSerializer.Byte;
Assert.IsTrue(ReferenceEquals(ordered.Serializer, PrimitiveSerializer.Byte));
Assert.AreEqual(0x10000, ordered.InMemoryLimit);
Assert.AreEqual(10, ordered.InMemoryLimit = 10);
Assert.AreEqual(DuplicateHandling.None, ordered.DuplicateHandling);
Assert.AreEqual(DuplicateHandling.FirstValueWins,
ordered.DuplicateHandling = DuplicateHandling.FirstValueWins); |
VB.NET | Copy Code |
---|
Dim ordered As var = New OrderedEnumeration(Of Byte)(Comparer(Of Byte).[Default], FailBeforeYield(Of Byte)(True))
Assert.IsTrue(ReferenceEquals(Comparer(Of Byte).[Default], ordered.Comparer))
ordered.Comparer = New ReverseOrder(Of Byte)(ordered.Comparer)
Assert.IsTrue(TypeOf ordered.Comparer Is ReverseOrder(Of Byte))
Assert.IsNull(ordered.Serializer)
ordered.Serializer = PrimitiveSerializer.[Byte]
Assert.IsTrue(ReferenceEquals(ordered.Serializer, PrimitiveSerializer.[Byte]))
Assert.AreEqual(&H10000, ordered.InMemoryLimit)
Assert.AreEqual(10, ordered.InMemoryLimit = 10)
Assert.AreEqual(DuplicateHandling.None, ordered.DuplicateHandling)
Assert.AreEqual(DuplicateHandling.FirstValueWins, ordered.DuplicateHandling = DuplicateHandling.FirstValueWins) |
Requirements
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
See Also